package org.example.petsystem.controller;

import org.example.petsystem.entity.ResultBody;
import org.example.petsystem.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/Address")
@CrossOrigin(origins="*")
public class AddressController {

    @Autowired
    private AddressService addressService;

    @PostMapping("/getUserAddresses")
    public ResultBody getUserAddresses(@RequestBody Map<String, Object> params) {
        return addressService.getUserAddresses(params);
    }

    @PostMapping("/saveUserAddresses")
    public ResultBody saveUserAddresses(@RequestBody Map<String, Object> params) {
        return addressService.saveUserAddresses(params);
    }

    @PostMapping("/deleteAddress")
    public ResultBody deleteAddress(@RequestBody Map<String, Object> params) {
        return addressService.deleteAddress(params);
    }

    @PostMapping("/setDefaultAddress")
    public ResultBody setDefaultAddress(@RequestBody Map<String, Object> params) {
        return addressService.setDefaultAddress(params);
    }
}